
use std::net::UdpSocket;



fn main() -> std::io::Result<()> {
    {
        let socket = UdpSocket::bind("127.0.0.1:52222")?;
        
        socket.connect("127.0.0.1:34254")?;
        

        std::thread::sleep(std::time::Duration::from_secs(10));
        let s = "hello";

        let amut = socket.send(s.as_bytes())?;
        println!("send bytes:{}", amut);

        let mut buf = [0; 10];
        let bytes = socket.recv(&mut buf)?;
        println!("recv bytes:{}, {}", bytes, std::str::from_utf8(&buf).unwrap());
    }
    Ok(())
}

